1
00:00:00,630 --> 00:00:01,880
Hello and welcome.

2
00:00:01,890 --> 00:00:10,640
In this video we will start creating the javascript logic that will enable the come down time to work.

3
00:00:10,980 --> 00:00:15,870
Let's begin with some javascript basics.

4
00:00:15,870 --> 00:00:27,090
What are methods methods are basically actions that can be performed on an object saw objects.

5
00:00:27,090 --> 00:00:31,440
Objects are basically containers for named valli's.

6
00:00:31,440 --> 00:00:41,670
For example a car can be an object a person can be an object set interval method the set into for metod

7
00:00:41,700 --> 00:00:45,740
basically is used when you want to set intervals.

8
00:00:46,080 --> 00:00:55,550
So it is used to call function at a specified intervals is usually in milliseconds so for example 1000

9
00:00:55,560 --> 00:01:00,120
milliseconds it would be equivalent to one second.

10
00:01:00,360 --> 00:01:09,360
So if you are great in a time and you want the time out or a clock tick every second you use this set

11
00:01:09,490 --> 00:01:11,220
interval method.

12
00:01:11,400 --> 00:01:21,060
So if thousand milliseconds is equivalent to one second we are also going to be using javascript date

13
00:01:21,240 --> 00:01:23,950
method did met us busy.

14
00:01:23,990 --> 00:01:32,060
We use to set and get data values using the javascript statement.

15
00:01:32,330 --> 00:01:40,260
It will allow you to set various dates and values so you can set it in the year the month the day the

16
00:01:40,380 --> 00:01:47,230
hours the minutes the seconds or saw in me.

17
00:01:47,820 --> 00:01:52,680
Javascript also comes with a built in maths method.

18
00:01:52,740 --> 00:01:55,920
One of the methods is called maths floor.

19
00:01:56,130 --> 00:02:02,000
This basically allows you to round numbers down once to the nearest integer.

20
00:02:02,010 --> 00:02:08,350
For example if you got a value of five point three rounded down to five.

21
00:02:08,710 --> 00:02:17,190
So quoting how a javascript logic for our projects will be used in methods will be referenced in objects

22
00:02:17,230 --> 00:02:21,930
will be used in the set of a method as well as Date met.

23
00:02:22,050 --> 00:02:25,810
Also maths top floor method.

24
00:02:26,010 --> 00:02:28,250
So I've got my text editor.

25
00:02:28,260 --> 00:02:37,560
I am going to create a javascript file so we click on the file here and I'm going to save ants and that

26
00:02:37,560 --> 00:02:40,700
should take me to my directory.

27
00:02:41,100 --> 00:02:45,490
So I am going to keep it in name of Count down.

28
00:02:45,540 --> 00:02:49,900
G s so I'll save it in the same directory.

29
00:02:49,920 --> 00:02:51,130
Just click on say.

30
00:02:51,480 --> 00:02:55,480
So far now is a javascript file.

31
00:02:55,770 --> 00:03:04,650
Now that we've created the javascript file the first thing I want to do is set the date that we are

32
00:03:04,650 --> 00:03:06,230
going to count to.

33
00:03:06,240 --> 00:03:08,850
You can choose any date for me.

34
00:03:08,860 --> 00:03:20,700
I'm going to come down to January 1st 2000 and 10 12 mid day so when I need to do I create a variable

35
00:03:20,910 --> 00:03:22,470
and give the variable in name.

36
00:03:22,500 --> 00:03:28,600
When you're creating variables is good to name your variables to reflect what the store.

37
00:03:28,770 --> 00:03:35,820
So I'm going to create a variable called Count Down date and I'm going to use the date motor out and

38
00:03:35,820 --> 00:03:41,300
I'll be referencing a new date inside B parameters for the method.

39
00:03:41,300 --> 00:03:43,160
I'm going to pass them.

40
00:03:43,290 --> 00:03:56,010
The value of January 1st 2009 18 also all time and seconds and I'll be using the get time method.

41
00:03:56,010 --> 00:04:05,820
So here I've created a variable called Countdown date and I've said that to you close to his new date

42
00:04:06,320 --> 00:04:07,580
and he never did.

43
00:04:07,620 --> 00:04:15,950
Fear values inside this parenthesis here because I want to come down to January 1st 2000 any team at

44
00:04:16,130 --> 00:04:26,220

45
12:00 now so does the hours the minutes and the seconds and I'm using the get time method which is a

46
00:04:26,520 --> 00:04:28,640
date method.

47
00:04:29,290 --> 00:04:39,250
Next one I do want to update make count down every one second so I am going to create another variable.

48
00:04:39,250 --> 00:04:46,250
And I'm going to also set it to of course of this set of function set for intervals.

49
00:04:46,270 --> 00:04:54,240
Be what you use use a set of metal to indicate the intervals you want to set.

50
00:04:54,600 --> 00:04:59,650
So I've created another variable and have called it variable variable x.

51
00:04:59,970 --> 00:05:04,040
And I've said that too cause so this set interval method.

52
00:05:04,310 --> 00:05:12,060
And inside the parentheses are passed to the function with a function you horswell me to have curly

53
00:05:12,060 --> 00:05:20,970
braces in between the calibrated is where I will had all the logic for the code that when they were

54
00:05:20,970 --> 00:05:23,140
the countdown time I had to work.

55
00:05:23,250 --> 00:05:30,750
So I'm going to tab down to separate the calibrators and every cause I write in between this curly process

56
00:05:31,260 --> 00:05:38,510
is what will constitute the logic that will make it come down time to work.

57
00:05:38,670 --> 00:05:46,120
So next I want to create a variable that will get today's date and time.

58
00:05:46,230 --> 00:05:53,940
So I've created a variable chord now to indicate the current date and I've said it to cause a new date

59
00:05:54,270 --> 00:05:55,010
and nothing.

60
00:05:55,020 --> 00:05:59,210
Brand It is and I've used the get time method what this will do.

61
00:05:59,430 --> 00:06:04,170
It will return to D date and time.

62
00:06:04,560 --> 00:06:16,110
Next thing I want to do is find the distance between this variable which is today's date and this variable

63
00:06:16,230 --> 00:06:26,500
here which is the count that date someone equating a variable called distance and I'm going to stop

64
00:06:26,520 --> 00:06:35,400
pracht this countdown date from the current date time which is some support in this variable from this

65
00:06:35,400 --> 00:06:43,690
variable and that will give me the distance between today's date and my count down.

66
00:06:44,130 --> 00:06:50,370
So I created another variable called distance and set that to Quantico the countdown date which is variable

67
00:06:50,370 --> 00:06:51,220
here.

68
00:06:51,240 --> 00:06:58,980
Mine is now which is variable here so this now reference the current date and time this count down their

69
00:06:58,980 --> 00:07:05,370
references date here which is a data counting down to the distance.

70
00:07:05,670 --> 00:07:12,670
Surprised that from this current date and that will tell us how much time we have left.

71
00:07:13,050 --> 00:07:22,980
So I'm going to end the part one of the javascript logic here in part 2 we will be doing the time calculations

72
00:07:23,040 --> 00:07:29,280
for the days hours minutes and the sequence.

73
00:07:29,280 --> 00:07:30,380
Thanks for watching.

74
00:07:30,420 --> 00:07:31,270
Bye for now.